<template>
  <div>
    <el-form :inline="true" :model="param">
      <el-form-item label="积分余额：">
        {{integralAble}}
      </el-form-item>
      <el-form-item label="当前积分价值：" style="margin-left:100px">
        {{pointPrice}}元
      </el-form-item>
    </el-form>
    <el-table :data="dataList" row-key="Id" border style="width: 100%; ">
      <el-table-column align="center" label="序号" width="80">
        <template slot-scope="scope">
          <span>{{(param.page - 1) * param.limit + scope.$index + 1}}</span>
        </template>
      </el-table-column>
      <el-table-column prop="remark" align="center" label="操作事项">
      </el-table-column>
      <el-table-column prop="value" align="center" label="积分数">
      </el-table-column>
      <el-table-column prop="create_time" align="center" label="操作时间">
      </el-table-column>
    </el-table>
    <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="param.page" :page-sizes="[10, 20, 50, 100]" :page-size="param.limit" :total="total" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
  </div>
</template>

<script>
import affiliateMerchantApi from '@/api/affiliateMerchantApi.js'
export default {
  data () {
    return {
      param: {
        page: 1,
        limit: 10,
      },
      dataList: [],
      total: 0,
      tableLoading: false,
      integralAble: 0,
      pointPrice: 0
    }
  },
  created () {
    this.getList()
  },
  methods: {
    getList () {
      this.tableLoading = true;
      affiliateMerchantApi.myPointPage(this.param).then(res => {
        if (res && res.data.code == 200) {
          this.integralAble = res.data.integralAble;
          this.pointPrice = res.data.pointPrice;
          this.dataList = res.data.page.list
          this.totalPage = res.data.page.totalCount
        }
        this.tableLoading = false;
      })
    },
    // 每页数
    sizeChangeHandle (val) {
      this.param.limit = val
      this.getList()
    },
    // 当前页
    currentChangeHandle (val) {
      this.param.page = val
      this.getList()
    },
    // 查询
    getDataList () {
      this.param.page = 1
      this.getList()
    }
  }
}
</script>

<style>
</style>